import random


class Boss:
    def __init__(self):
        self.HP = 100


class Player:
    def __init__(self):
        self.HP = 100

    def f1(self):   # 技能1
        attack = 2 * random.randint(10, 16)
        # 添加眩晕效果
        effect = '无', '眩晕'
        return attack, effect

    def f2(self):   # 技能2
        attack = 3 * random.randint(10, 16)
        # 添加玩家虚弱效果
        effect = '攻击力下降', '无'
        return attack, effect

    def f3(self):   # 技能3
        attack = random.randint(10, 16)
        # 添加玩家无视闪避效果
        effect = '攻击必中', '无'
        return attack, effect


def fight():    # 回合流程
    b = Boss()
    p = Player()
    count = 1
    p_win = 0
    effect = None
    while 1:
        b_attack = random.randint(10, 20)
        print('-'*10+f'第{count}回合'+'-'*10)
        choose = input('玩家选择攻击招式：')
        if choose == '1':
            jn = p.f1()
            print('玩家释放技能1',jn[0])
        elif choose == '2':
            jn = p.f2()
            print('玩家释放技能2',jn[0])
        elif choose == '3':
            jn = p.f3()
            print('玩家释放技能3',jn[0])
        else:
            print('只能选择1、2、3')
            continue
        print('伤害判定：')
        if effect == '攻击必中':
            print('是否命中boss：是')
            b.HP -= jn[0]
            b.HP = max(0, b.HP)
        else:
            if random.randint(0, 1):
                print('是否命中boss：是')
                if effect == '攻击力下降':
                    b.HP -= jn[0]/2
                else:
                    b.HP -= jn[0]
                b.HP = max(0, b.HP)
            else:
                print('是否命中boss：否')
        print('boss剩余血量：', b.HP)
        if not b.HP:
            p_win = 1
            print('玩家剩余血量：', p.HP)
            print('玩家状态：', jn[1][0])
            print('boss状态：', jn[1][1])
            break
        if effect != '眩晕':
            p.HP -= b_attack
            p.HP = max(0, p.HP)
        print('玩家剩余血量：', p.HP)
        print('玩家状态：', jn[1][0])
        print('boss状态：', jn[1][1])
        if not p.HP:
            break
        effect = '眩晕' if jn[1][0] == '无' else jn[1][0]
        print('游戏是否结束：否')
        count += 1
    print('游戏是否结束：是')
    if p_win:
        print('游戏结束，玩家胜利!')
    else:
        print('游戏结束，玩家失败!')


fight()